X_LIBS 		+= libxlibc.a libwm.a libSDL2.a

X_INCDIRS	+= gnuboy/ gnuboy/lib gnuboy/include
X_CFLAGS	+= -O3 -std=c99 -w -DIS_LITTLE_ENDIAN -D_GNU_SOURCE=1 -D_REENTRANT

NAME		:= gnuboy.xapp
SRC 	+= sys/nxos/nxos.c sys/dummy/io.c
SRC		+= sys/sdl2/sdl-video.c sys/sdl2/sdl-audio.c sys/sdl2/sdl-input.c ./src/lcd.c ./src/refresh.c \
        ./src/lcdc.c ./src/palette.c ./src/cpu.c ./src/mem.c ./src/rtc.c ./src/hw.c ./src/sound.c \
        ./src/events.c ./src/keytable.c ./src/loader.c ./src/save.c ./src/debug.c ./src/io.c \
        ./src/emu.c ./src/main.c ./src/rccmds.c ./src/rckeys.c ./src/rcvars.c ./src/rcfile.c ./src/exports.c \
        ./src/split.c ./src/path.c ./lib/gz/inflate.c lib/xz/xz_crc32.c lib/xz/xz_crc64.c lib/xz/xz_dec_lzma2.c \
        lib/xz/xz_dec_stream.c lib/xz/xz_dec_bcj.c

define CUSTOM_TARGET_CMD
echo [APP] $@; \
$(LD) $(X_LDFLAGS) $(X_OBJS) -o $@ $(patsubst %, -L%, $(X_LIBDIRS)) \
	--start-group $(patsubst %, -l:%, $(X_LIBS)) --end-group
endef
